package com.group.library.order.controller.admin;

import com.group.library.order.dto.MessageBean;
import com.group.library.order.entity.User;
import com.group.library.order.service.UserBaseService;
import com.group.library.order.util.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author: Lai
 * Email: aYong1324@163.com
 * Time: 2022年5月16日14:59:00
 * Description: 此类主要是负责管理员对用户的一些操作
 * 具体有：查看，更改用户信息(需权限)，删除用户等等
 */

@RestController
@RequestMapping("/admin/user")
public class UserManageController {

    @Autowired
    private UserBaseService userBaseService;

    @RequestMapping(value = "/listUser.action",method = RequestMethod.GET)
    public MessageBean getUserInfos(Integer limit,Integer page,String name,String phone,String number){
        System.out.println(userBaseService.listUser(page,limit,name,phone,number));
        return MessageUtil.success(userBaseService.listUser(page,limit,name,phone,number));
    }

    @RequestMapping(value = "/addUser.action",method = RequestMethod.PUT)
    public MessageBean addUser(){
        if(userBaseService.addUser()){
            return MessageUtil.success("插入成功！");
        }
        return MessageUtil.failure("插入失败！");
    }


}
